<?php
    /*
     * post grabbed rss items in articles.
     *
    */
    
    ini_set('max_execution_time', 3600);
    error_reporting(E_ALL);
    require_once('../config/constant.php');
    require_once(DAEMONE_HOME . '/lib/lib_database.php');
	
	echo date('l jS \of F Y h:i:s A'), "||";
	
	$result = execute_query('update articles ar, rss_feed_item rs '
             . ' set ar.post_modified = now(), ar.post_status = 3, ar.slug_status = 1, ar.moderate_status = 1, ar.grabbed_status = 4, ar.article_title = rs.title, ar.slug_article_title = rs.title_slug, ar.article_content = rs.html_article, ar.article_content_filtered = rs.html_article, ar.category_id = rs.category_id, ar.html_meta_keywords = rs.html_meta_keywords, ar.grabbed_rss_url = rs.article_original_url, rs.grabbed_status = 4 where ar.rss_feed_item_id = rs.item_id and rs.grabbed_status=2');
    execute_query("insert into http_cache_file (path, uri, is_file) select concat('/cache/',date_format(post_date,'%Y/%m'),'/',article_id,'.htm'), concat('/article_controller/show_article_detail/',article_id), 1 from articles where grabbed_status=4");
	execute_query("update articles set grabbed_status=3 where grabbed_status=4");
	execute_query("delete from rss_feed_item where grabbed_status=4");
	execute_query("commit");
	echo date('l jS \of F Y h:i:s A'), "||";
	

?>
